<?php

	namespace app\index\controller;

	use app\common\controller\Frontend;
	use think\Db;

	class Index extends Frontend
	{

		protected $noNeedLogin = '*';
		protected $noNeedRight = '*';
		protected $layout = '';

		public function index () {
			return $this->view->fetch();
		}

		public function news () {
			$newslist = [];

			return jsonp(['newslist' => $newslist, 'new' => count($newslist), 'url' => 'https://www.fastadmin.net?ref=news']);
		}


		public function chat () {
			return $this->view->fetch();
		}


		public function chatRoom () {
			$fromid = intval($this->request->param('fromid'));
			$toid = intval($this->request->param('toid'));


			$member = Db::name('admin')->field('id,nickname')->where("id", $toid)->find();

			$this->assign([
				'fromid' => $fromid,
				'toid'   => $toid,
				'toname' => $member['nickname']
			]);

			return $this->view->fetch();
		}

		public function lists () {


			$fromid = intval($this->request->param('fromid'));

			$this->view->assign(['fromid'=>$fromid]);

			return $this->view->fetch('index/lists');

		}


	}
